package com.example.pagingdemo.api;

import com.example.pagingdemo.model.ApiResponse;
import com.example.pagingdemo.model.DoctorVo;
import com.example.pagingdemo.model.GithubUser;
import com.example.pagingdemo.model.Movies;
import com.example.pagingdemo.model.UserResponse;

import java.util.List;

import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

/**
 * @author: tuyrt7 on 2020/9/9.
 */
public interface Api {

    /**
     * 测试API
     * //根据 position
     * http://t.yushu.im/v2/movie/search?start=0&count=8
     * http://t.yushu.im/v2/movie/in_theaters?start=0&count=8
     * //根据页码，每页数目 请求分页, PageKeyItemDataSource
     * https://api.stackexchange.com/2.2/users?page=1&pagesize=6&site=stackoverflow
     * //根据最后一个 item.id 来分页, ItemKeyDataSource （github接口对网络有要求）
     * https://api.github.com/users?since=0&per_page=6
     */

    public static final String BASE_URL = "http://t.yushu.im/";
    public static final String API_KEY = "0df993c66c0c636e29ecbb5344252a4a";

    public static final String BASE_URL2 = "https://api.stackexchange.com/";

    public static final String BASE_URL3 = "https://api.github.com/";


    public static final String BASE_URL4 = "http://dev2.bayair.cn:8065/xiaoke/api.php/";

    /**
     * 获取当前正在上映的电影
     *
     * @param since
     * @param perPage
     */
    @GET("v2/movie/in_theaters")
    Call<Movies> getMovies(@Query("start") int since, @Query("count") int perPage);

    @GET("2.2/users")
    Call<UserResponse> getUsers(@Query("page") int page, @Query("pagesize") int pageSize, @Query("site") String site);

    @GET("users")
    Call<List<GithubUser>> getGithubUsers(@Query("since") int since, @Query("per_page") int pageSize);

    @FormUrlEncoded
    @POST("client/doctor_lists")
    Call<ApiResponse<DoctorVo>> getDoctorList(@Field("client_id") int client, @Field("page") int page, @Field("rows") int rows);

}
